    <style type="text/css">
    .belongToLi
    {
    	display: inline;
    	list-style-type: none;
    	padding-right: 20px; 
    }
    </style>
    <script src="/public/library/hvn/place.js" type="text/javascript"></script>
	<script src="/public/library/autocomplete/autocomplete.js" type="text/javascript"></script>
	<link rel="stylesheet" href="/public/library/autocomplete/autocomplete.css" type="text/css">

<form accept-charset="UTF-8" action="<?= $this->escape($this->form->getAction()) ?>"
      method="<?= $this->escape($this->form->getMethod()) ?>" >
      
<script language="Javascript">

$(function(){
	setAutoComplete("belong_to_ac_input", "belong_to_ids", "belong_to_names", "results", "/en/place/ajax/autocomplete?part=");//"/public/library/autocomplete/autocomplete.php?part=");
	
	$("form").submit(function(){
		var tmp = '';
		var ids = '';
		var dis = '';
		$("#belong_to_names ul li").each(function(i){
			//get ids: $(this).attr('name')
			//get name, ids and distance
			if (tmp == '' && ids == '')
			{
				tmp = $(this).find("span:first").text();
				ids = $(this).attr('name');
				dis = $(this).find("span:last").text();
			}
			else
			{
				tmp = tmp + ',' + $(this).find("span:first").text();
				ids = ids + ',' + $(this).attr('name');
				dis = dis + ',' + $(this).find("span:last").text();
			}
		});
		$("#belong_to_ids").val(ids);
		$("#belong_to_names_submit").val(tmp);
		$("#distance").val(dis);
	});
	
	//populate belong_to_names_submit & "belong_to_names ul"
	function create_belong_to_ul(belongToIds, belongToNamesSubmit, belongToNames)
	{
		if($("#" + belongToIds).val() != null)
		{
			ids = $("#" + belongToIds).val().split(',');
			//console.log(ids);
			names = $("#" + belongToNamesSubmit).val().split(',');
			dis = $("#distance").val().split(',');
			belongNames = "#" + belongToNames;
			
			if (ids.length > 0 && ids[0] != '')
			{
				for (j = 0;j < ids.length; j++)
				{
					name = names[j];
					id = ids[j];
					d = dis[j];
					$newLi = $("<li name='" + id + "' ><span>" + name + " </span>" + "<span>" + d + "</span>" +' km'
								+ "<sup><a href='javascript:void()'>remove</a></sup></li>");
					$newLi.appendTo($(acTargetName +" ul"));
					
					//update dom again
					update_remove_place_actions($newLi);
				}
			}
		}
	}
	
	create_belong_to_ul("belong_to_ids", "belong_to_names_submit", "belong_to_names");
	
	$("#belong_to_ac_input").attr('autocomplete', 'OFF');
	
	$('.belongToDOMWindow').openDOMWindow({ 
		height:200, 
		width:365, 
		eventType:'click',
		windowSourceID:'#groupId',  
		overlay:0, 
		windowBGColor:'#FFFF00', 
		borderColor:'#5D5DF4', 
		overlayOpacity:15  
		}); 
	$('.closeBelongToDOMWindow').closeDOMWindow({eventType:'click'}); 
	
	var mode = '';
    getAddress(mode);
    getCategoryType(mode);

});
</script>

<style>
  .meals { background:#FFFFF; margin:3px 3px 5px 5px; width:100px; 
        height:100px; float:left; }
</style>
   
<?if ($this->justMessage == 1) :?>
<?=t(769) ?>
<?endif ?>
<?if (!empty($this->successMessage)) :?>
<div class="successMessage"><?=$this->successMessage; ?></div>
<a href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'view'))?>?id=<?=$this->id?>"><?=t(134)?></a>
<?endif?>

<div class="errorMessage"><?=$this->errorMessage; ?></div>
<ul  class="navigationTab">
<li> <a href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'edit-basic'))?>?id=<?=$this->id?>"> <?=t(745) ?> </a> </li>
<li  class="selected"> <a href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'edit'))?>?id=<?=$this->id?>"> <?=t(746) ?> </a> </li>
<li> <a href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'gallery'))?>?id=<?=$this->id?>"> <?=t(6) ?> </a> </li>
<li> <a href="<?=$this->hvnUrl(array('module' => 'event', 'action' => 'new'))?>?belong_to_ids=<?=$this->id?>&belong_to_names_submit=<?=$this->placeName?>"> <?=t(221)?> </a> </li>
<li> <a target="_blank" href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'view'))?>?id=<?=$this->id?>"> <?=t(134) ?> </a> </li>

</ul>


<fieldset class="expansible"><legend><span><?=t(821) ?></span></legend>
	<table>
		<tr>
			<td><?=t(796) ?>:</td>
			<td><?= $this->form->area?> (<?=t(797) ?>)</td>
		</tr>
		<? $restaurant = Zend_Registry::get('configuration')->restaurant;?>
			<?if($this->rtype == $restaurant && !empty($this->form->opening_hours)) :?>
				<tr>
					<td><?=t(768) ?>:</td>
					<td><?= $this->form->opening_hours?> (e.g: 07:00 - 22:00)</td> 
				</tr>
			<?endif?>
		<?if(!empty($this->form->belong_to_ids)) :?>
		<tr>
			<td><?=t(765) ?>:</td>
			<td>
				<input type="button" class="belongToDOMWindow" value="Add" /> 
				<div id="groupId" style="display:none;"> 
				<table>
						<tr>
							<td><?=t(767) ?>:</td>
							<td><?=$this->district_name?> - 
								<?=$this->city_name?>
							</td>
						</tr>
						<tr>
							<td><?=t(766) ?>:</td>
							<td><?= $this->form->category?></td>
						</tr>
						<tr>
							<td><?=t(115) ?>:</td>
							<td><?= $this->form->rtype?></td>
						</tr>
						<tr>
							<td><?=t(765) ?>:</td>
							<td><?= $this->form->belong_to_ac_input?> <span id="newBelongToPlaceId"></span></td>
							<td<div id="resultID"></div></td>
						<tr>
							<td></td>
							<td><?= $this->form->length?>(km)</td>
						</tr>
						<tr>
							<td></td>
							<td>
							<div align="right">
							<input type="button" value="Add" class="belongButton" />
							<input type="button" value="Close" class="closeBelongToDOMWindow" />
							</div>
							</td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td></td>
			<td> <span id="belong_to_names">
			    <ul> 
				</ul>
				</span>
			</td>
		</tr>

		<tr>
			<td></td>
			<td><?= $this->form->belong_to_ids?> <br/>
			<?= $this->form->belong_to_names_submit?>
			<?= $this->form->distance ?>
			</td>
		</tr>
		<?endif?>
		
		
	</table>	
</fieldset>

<?if(!empty($this->form->fee)) :?>
<fieldset class="expansible"><legend><span><?=t(764) ?></span></legend>
	<table>
	<tr>
		<td><?=t(764) ?></td>
		<td><?= $this->form->fee ?></td>
	</tr>
	<tr>
		<td><?=t(763) ?>:</td>
		<td><?= $this->form->fee_basis ?></td>
	</tr>
	<tr>
		<td><?=t(762) ?>:</td>
		<td><?= $this->form->fee_currency ?></td>
	</tr>
	<tr>
		<td><?=t(785) ?>:</td>
		<td><?= $this->form->payment_method?></td>
	</tr>
</table>
</fieldset>
<?endif?>

<? $restaurant = Zend_Registry::get('configuration')->restaurant;?>
<?if($this->rtype == $restaurant && !empty($this->form->take_away)) :?>
<fieldset class="expansible"><legend><span><?=t(760) ?></span></legend>
	<table>
		<tr>
			<td><?=t(758) ?>:</td>
			<td><?= $this->form->take_away?></td>
		</tr>
		<tr>
			<td><?=t(759) ?>:</td>
			<td><?= $this->form->delivery?></td>
		</tr>
		<tr>
			<td><?=t(757) ?>:</td>
			<td><?= $this->form->meals?></td>
		</tr>
	</table>
</fieldset>
<?endif?>


<? $pagoda = Zend_Registry::get('configuration')->pagoda;?>
<?if($this->rtype == $pagoda && !empty($this->form->built_year)) :?>
<fieldset class="expansible"><legend><span><?=t(756) ?></span></legend>
	<table>
		<tr>
			<td><?=t(755) ?>:</td>
			<td><?= $this->form->built_year?></td>
		</tr>
		<tr>
			<td><?=t(754) ?>:</td>
			<td><?= $this->form->festive_days_from ?></td>
		</tr>
		<tr>
			<td><?=t(753) ?>:</td>
			<td><?= $this->form->festive_days_to?></td>
		</tr>
	</table>
</fieldset>
<?endif?>

<fieldset class="expansible"><legend><span><?=t(825) ?></span></legend>
	<table>
		<tr>
			<td><?=t(750) ?>:</td>
			<td><?= $this->form->phone?></td>
		</tr>
		<tr>
			<td><?=t(751) ?>:</td>
			<td><?= $this->form->fax?></td>
		</tr>
		<tr>
			<td><?=t(752) ?>:</td>
			<td><?= $this->form->contact_email ?></td>
		</tr>
		<tr>
			<td><?=t(824) ?>:</td>
			<td><?= $this->form->website ?></td>
		</tr>
	</table>
</fieldset>

<? $hotel = Zend_Registry::get('configuration')->hotel;?>
<? foreach ($hotel as $k => $h) :?>
    <? if ($h == $this->rtype && !empty($this->form->number_of_rooms)) :?> 
	<fieldset class="hotel"><legend><span><?=t(749) ?></span></legend>
		<table>
			<tr>
				<td><?=t(747) ?>:</td>
				<td><?= $this->form->number_of_rooms ?></td>
			</tr>
			<tr>
				<td><?=t(748) ?>:</td>
				<td><?= $this->form->number_of_available_rooms ?></td>
			</tr>
		</table>
	</fieldset>
	<?endif?>
<?endforeach?>

<fieldset class="expansible"><legend><span><?=t(21) ?></span></legend>
	<table>
		<tr>
			<td><?= $this->form->article_body ?></td>
		</tr>
		<tr>
			<td><?=$this->form->article_originality ?></td>
		</tr>
		
	</table>
</fieldset>


<?=$this->form->update ?>

<input type="hidden" name="id" value="<?= $this->id; ?>" />
<input type="hidden" name="district_name" value="<?= $this->district_name; ?>" />
<input type="hidden" name="city_name" value="<?= $this->city_name; ?>" />
<input type="hidden" name="rtype" value="<?= $this->rtype; ?>" />
</form>
